import request from '@/utils/request.js'

//登录
export const login = (obj) => request.post('/api/auth/login', obj)

//注册
export const sign = (obj) => request.post('/api/auth/register', obj)

//获取用户详情
export const getUserInfo = () => request.get('/api/user')

//修改用户信息
export const updateUserInfo = (data) => request.put('/api/user', data)

//更新头像
export function uploadAvatar(data) {
  return request({
    url: '/api/user/avatar',
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data
  })
}
